Skip to content

Conversation

V02460
Copy link
Contributor

@V02460 V02460 commented Jul 21, 2025

The docs currently note that the kid property specified for secrets.keys items has to be arbitrary. This PR removes that requirement and documents more loose ones instead.

The JWT spec itself does have only few restrictions on KIDs. Having this additional requirement of arbitrary KIDs in MAS would disqualify the use of a hash function or a running number to create KIDs.

The PR also clarifies that it is ok for KIDs to change between restarts.

The suggested documentation would make automatic key management easier for me. I think these more loose requirements don’t break anything in MAS, but please correct me if I’m wrong.

PS: I’m thinking about making the kid property optional and auto-generating it by MAS if missing, e.g., by hashing the corresponding key. Would you take such a PR?

Copy link
Member

@sandhose sandhose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the 'arbitrary' here was meant to say 'any value you want, doesn't matter'. That's probably something that sounds about right in french, but not in english :)

I'd be happy to have the kid derived from a hash; the reason I didn't do it back then was that I couldn't really find a standard key fingerprinting mechanism, but admittedly I didn't look very far

The key can either be specified inline (with the `key` property), or loaded from a file (with the `key_file` property).
Each entry must have a unique `kid`, plus the key itself.
The `kid` can be any case-sensitive string value as long as it is unique to this list;
`kid` values don’t need to be stable across restarts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is actually not true? If we issue an id_token and change the kid of the key that was used to sign it, the client won't be able to verify it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I hope this is better now?

@sandhose sandhose enabled auto-merge July 23, 2025 10:33
@sandhose sandhose disabled auto-merge July 23, 2025 10:33
@sandhose sandhose enabled auto-merge July 23, 2025 10:34
@sandhose sandhose added the A-Documentation Improvements or additions to documentation label Jul 23, 2025
@sandhose sandhose changed the title docs: Remove requirement for arbitrary KIDs docs: Clarify requirements about kids in the secrets.keys config Jul 23, 2025
@sandhose sandhose merged commit 97cd5d8 into element-hq:main Jul 23, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants